import request from '@/router/axios';
import {
  baseURL
} from '@/api/common';
//调试或整体打包时使用END

import serviceList from '@/config/serviceList';

const {
  exam
} = serviceList

/*根据id获得考试*/
export const getTestById = (data) => {
  return request({
    url: `${baseURL}api/${exam}/examUser/getTestById`,
    method: 'post',
    data
  })
}
// 保存考试
export const saveTest = (data) => {
  return request({
    url: `${baseURL}api/${exam}/examUser/saveTest`,
    method: 'post',
    data
  })
}

// 定时保存考试信息
export const saveUserCacheTest = (data) => {
  return request({
    url: `${baseURL}api/${exam}/examUser/saveUserCacheTest`,
    method: 'post',
    data
  })
}
// 若前端local中获取不到信息，在接口获取考试信息
export const getUserCacheTest = (data) => {
  return request({
    url: `${baseURL}api/${exam}/examUser/getUserCacheTest`,
    method: 'post',
    data
  })
}
// 获取考试服务器时间
export const currentServerTime = () => {
  return request({
    url: `${baseURL}api/${exam}/examUser/currentServerTime`,
    method: 'get',
  })
}